package cn.mayday.junit;

/**
 * @description: TODO
 * @author: mayday
 * @date: 2020/7/24 8:49
 * @version: 1.0
 */
public class SingletonClassInstance {

    private static SingletonClassInstance singletonClassInstance = null;

    private SingletonClassInstance() {

    }

    public static SingletonClassInstance getInstance() {
        if (null == singletonClassInstance) {
            synchronized (SingletonClassInstance.class) {
                if (null == singletonClassInstance) {
                    singletonClassInstance = new SingletonClassInstance();
                }
            }
        }
        return singletonClassInstance;
    }

    public synchronized void testMethod1() {
        System.out.println("method1 +++++++++");
    }

    public synchronized void testMethod2() {
        System.out.println("method1 +++++++++");
    }
}
